import request from '@/utils/request'

export function ruleList(query) {
  return request({
    url: '/reward/listRule',
    method: 'get',
    params: query
  })
}

export function addReward(data) {
  return request({
    url: '/reward/add',
    method: 'post',
    data
  })
}

export function updateReward(data) {
  return request({
    url: '/reward/update',
    method: 'put',
    data
  })
}

export function deleteReward(ruleId) {
  return request({
    url: '/reward/delete',
    method: 'delete',
    params: {ruleId}
  })
}

export function logReward(data){
  return request({
    url: '/reward/log',
    method: 'get',
    params: data
  })
}

export function detailReward(ruleId) {
  return request({
    url: '/reward/detail',
    method: 'get',
    params: {ruleId}
  })
}

export function updateRewardStatus(ruleId) {
  return request({
    url: '/reward/updateStatus',
    method: 'put',
    params: {ruleId}
  })
}

export function detailByLog(logId){
  return request({
    url: '/reward/detailByLog',
    method: 'get',
    params: { logId }
  })
}


export function rewardStatistic(startDate,endDate){
  return request({
    url: '/reward/rewardStatistic',
    method: 'get',
    params: { startDate,endDate }
  })
}

export function distributionStatistic(startDate,endDate){
  return request({
    url: '/reward/distributionStatistic',
    method: 'get',
    params: { startDate,endDate }
  })
}


export function getPeriodStatistics(data){
  return request({
    url: '/reward/periodStatistics',
    method: 'get',
    params: data,
  })
}



